﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using Microsoft.SharePoint;
using System.Text.RegularExpressions;

namespace LizardSoft.Common.FlexibleStructureDeployment
{
    public static partial class StructureHelper
    {
        private static void DeleteOldFields(SPWeb web, string listFolderUrl, SPContentTypeId listContentTypeId, SPContentType siteContentType)
        {
            SPFieldLinkCollection siteContentTypeFieldLinks = siteContentType.FieldLinks;
            DeleteContentTypeFields(web, listFolderUrl, listContentTypeId, fieldName =>
            {
                SPFieldLink tryGetFieldLink = siteContentTypeFieldLinks[fieldName];
                if (tryGetFieldLink == null) // в типе контента сайта поля уже нет, но в типе контента списка - есть
                {
                    return true;
                }
                else return false;
            });
        }
    }
}
